<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/6/8
  Time: 16:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <title>客户新建</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css">
</head>
<body>
<form class="layui-form" >
    <div style="background: #f3ff4f"><h2>公司信息</h2></div>
    <div class="layui-form-item">
        <label class="layui-form-label">客户名称</label>
        <div class="layui-input-inline">
            <%--lay-verify="required" 表示表单验证，必填--%>
            <input type="text" name="name" lay-verify="required" placeholder="客户名称" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">公司电话</label>
            <div class="layui-input-inline">
                <input type="text" name="company_phone" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">客户状态</label>
            <div class="layui-input-inline">
                <select name="status" lay-verify="required" lay-search="">
                    <option value="">请选择</option>
                    <option value="潜在客户">潜在客户</option>
                    <option value="成交客户">成交客户</option>
                    <option value="意向客户">意向客户</option>
                    <option value="失败客户">失败客户</option>
                    <option value="已流失客户">已流失客户</option>
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">意向产品</label>
            <div class="layui-input-inline">
                <input type="text" name="company_phone"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">客户类别</label>
            <div class="layui-input-inline">
                <select name="type" lay-verify="required" lay-search="">
                    <option value="">请选择</option>
                    <option value="普通客户">普通客户</option>
                    <option value="VIP客户">VIP客户</option>
                    <option value="老客户">老客户</option>
                    <option value="代理商">代理商</option>
                    <option value="供货商">供货商</option>
                    <option value="合作伙伴">合作伙伴</option>
                    <option value="其他">其他</option>
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">客户来源</label>
            <div class="layui-input-inline">
                <select name="source"  lay-search="">
                    <option value="">请选择</option>
                    <option value="注册会员">注册会员</option>
                    <option value="朋友介绍">朋友介绍</option>
                    <option value="客户介绍">客户介绍</option>
                    <option value="电子商务">电子商务</option>
                    <option value="合作伙伴">合作伙伴</option>
                    <option value="广告">广告</option>
                    <option value="职员引介">职员引介</option>
                    <option value="市场活动">市场活动</option>
                    <option value="口头传达">口头传达</option>
                    <option value="其他">其他</option>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">客户等级</label>
            <div class="layui-input-inline">
                <select name="levels"  lay-search="">
                    <option value="">请选择</option>
                    <option value="五星客户">五星客户</option>
                    <option value="四星客户">四星客户</option>
                    <option value="三星客户">三星客户</option>
                    <option value="二星客户">二星客户</option>
                    <option value="一星客户">一星客户</option>
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">客户信用度</label>
            <div class="layui-input-inline">
                <select name="credit"  lay-search="">
                    <option value="">请选择</option>
                    <option value="五星客户">五星客户</option>
                    <option value="四星客户">四星客户</option>
                    <option value="三星客户">三星客户</option>
                    <option value="二星客户">二星客户</option>
                    <option value="一星客户">一星客户</option>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">客户成熟度</label>
            <div class="layui-input-inline">
                <select name="maturity"  lay-search="">
                    <option value="">请选择</option>
                    <option value="明确交易意向">A+：明确交易意向</option>
                    <option value="有初步成交意向">A-：有初步成交意向</option>
                    <option value="关键人有成交意向">B+：关键人有成交意向</option>
                    <option value="关键人成交意向不确定">B-：关键人成交意向不确定</option>
                    <option value="初步联系，有意向">C+：初步联系，有意向</option>
                    <option value="初步联系，意向不明确">C-：初步联系，意向不明确</option>
                    <option value="新建客户">D：新建客户</option>
                    <option value="有明显拒绝">E：有明显拒绝</option>
                    <option value="无效客户">F：无效客户</option>
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">所在地址</label>
            <div class="layui-input-inline">
                <input type="text" name="area"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">邮政编码</label>
            <div class="layui-input-inline">
                <input type="text" name="post_code"  autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">详细地址</label>
        <div class="layui-input-block">
            <input type="text" name="company_address" autocomplete="off" class="layui-input">
        </div>
    </div>

    <%--<div class="layui-form-item">
        <label class="layui-form-label">相关文件</label>
        <div class="layui-input-inline">
               &lt;%&ndash; <input type="file" name="headpic">&ndash;%&gt;
        </div>
    </div>--%>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">客户介绍</label>
        <div class="layui-input-block">
            <textarea name="description" placeholder="请输入内容" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">传真地址</label>
            <div class="layui-input-inline">
                <input type="text" name="fax_address"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">公司网址</label>
            <div class="layui-input-inline">
                <input type="text" name="company_website"  autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">法人</label>
            <div class="layui-input-inline">
                <input type="text" name="corporation"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">开户银行</label>
            <div class="layui-input-inline">
                <input type="text" name="deposit_bank"  autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">银行账号</label>
        <div class="layui-input-block">
            <input type="text" name="bank_account" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">年营业额</label>
        <div class="layui-input-block">
            <input type="text" name="annual_sale" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">营业执照注册号</label>
        <div class="layui-input-block">
            <input type="text" name="license_number" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">地税登记号</label>
        <div class="layui-input-block">
            <input type="text" name="land_tax_number" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">国税登记号</label>
        <div class="layui-input-block">
            <input type="text" name="national_tax_number" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div style="background: #f3ff4f"><h2>主要联系人</h2></div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">姓名</label>
            <div class="layui-input-inline">
                <input type="text" name="linkman.name" lay-verify="required"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">生日</label>
            <div class="layui-input-inline">
                <input type="date" name="linkman.birthday"  autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
            <input type="radio" name="linkman.sex" value="男" title="男" checked="">
            <input type="radio" name="linkman.sex" value="女" title="女">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">办公室电话</label>
            <div class="layui-input-inline">
                <input type="text" name="linkman.office_phone"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">手机电话</label>
            <div class="layui-input-inline">
                <input type="text" name="linkman.mobile_phone"  autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <button style="margin-left: 250px" layui-btn-primary lay-submit class="layui-btn" >重置</button>
        <button lay-filter="add2" lay-submit class="layui-btn" >保存</button>
    </div>
</form>
<script src="${pageContext.request.contextPath}/static/layui/layui.js"></script>
<script>
    //layui引入特定模块的方式
    layui.use(['layer', 'form','jquery'], function () {
        var layer = layui.layer//layer 弹窗对象
            , form = layui.form;//表单对象
        var $=layui.$;

        layer.msg('Hello World');
        //表单提交监听
        form.on("submit(add2)",function (data) {
            console.log(data);
            //发起异步请求，新增 data.field 表单数据
            $.post("/customer/add",data.field,function (result) {
                if(result.code==0){
                    layer.msg("新增成功")
                    //刷新父窗口的表格 parent 父窗口对象
                    parent.layui.table.reload("roleTable",{
                        page:{
                            curr:1
                        }
                    })
                    //关闭本窗口
                    //当你在iframe页面关闭自身时
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index); //再执行关闭
                }
                else if (result.code===403){
                    window.location.href="${pageContext.request.contextPath}/403.jsp"
                }
            },"json")
            return false;
        })
    });
</script>
</body>
</html>
